<?php
declare (strict_types = 1);

namespace app\admin\validate;

use think\Validate;

class Role extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */	
	protected $rule = [
	    'id'          => 'number',
	    'name'        => 'require',
        'status'      => 'require',
        'role_column' => 'require'
    ];
    
    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */	
    protected $message = [
        'id.require'          => 'ID参数错误',
        'name.require'        => '角色名称不能为空',
        'status.require'      => '请选择角色状态',
        'role_column.require' => '请选择栏目管理权限'
    ];

    /**
     * 定义情景信息
     *
     * @var array
     */
    protected $scene = [
        'add'   => ['name','role_column', 'is_delete'],
        'edit'  => ['id', 'name','role_column', 'is_delete'],
    ];
}
